<template>
    <div class="datePicker">
        <el-date-picker
            v-model="value"
            placeholder="选择日期"
            type="datetime"
            :disabled="isDisabled(iptAttritube.fieldAttribute)"
            :format="iptAttritube.showAccuracy"
            :value-format="iptAttritube.showAccuracy"
        >
        </el-date-picker>
    </div>
</template>

<script>
export default {
    props: {
        iptAttritube: {
            type: Object,
            default: () => {}
        }
    },
    data() {
        return {
            value: '',
            disabled: false
        }
    },
    methods: {
        defaultData(d) {
            this.value = ''
            d.map(item => {
                if(item.customFieldId == this.iptAttritube.id) {
                    this.value = item.value
                }
            })
        },
        isDisabled(iptAttritube) {
            let attr = JSON.parse(iptAttritube)
            return attr.disabled || false
        },
        removeSure() {
            
        }
    },
    watch: {
        value() {
            let value = {
                value: this.value,
                state: true
            }
            this.$emit('handleChange', value)
        }
    }
}
</script>